package com.phms.filter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import java.io.IOException;

/**
 * 过滤器实现类
 */

public class TimeFilter implements Filter {

    /**
     * 日志记录
     */
    private final Logger logger = LoggerFactory.getLogger(TimeFilter.class);

    /**
     * 初始化过滤器
     */
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        logger.info("=======初始化过滤器=========");
    }

    /**
     * 处理过滤
     */
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
            throws IOException, ServletException {
        //放行
        filterChain.doFilter(request, response);
    }

    /**
     * 销毁过滤器
     */
    @Override
    public void destroy() {
        logger.info("=======销毁过滤器=========");
    }
}
